<?php
/* @var $tabItems array
 * @var $tabItem TabItem
 */
?>
<script type="text/javascript">
    $(document).ready(function() {
	tabItem = $("div.tabs div.tnav ul li");
	tabContent = $("div.tcon > div");
	tabContent.hide();
	tabContent.eq(0).fadeIn(500);
	$.each(tabItem, function(index) {
	    $(this).click(function() {
		tabItem.removeClass("active");
		$(this).addClass("active");
		tabContent.css("display", "none");
		tabContent.eq(index).fadeIn(500);
	    });
	});
    });
</script>

<div class="tabs">
    <div class="tnav">
        <ul>
	    <?php for ($i = 0; $i < count($tabItems); $i++): ?>
		<?php if ($tabItems[$i]->status == LGConstant::PUBLISH_STATUS): ?>
		    <li <?php echo $i == 0 ? 'class="active"' : '' ?>><a href="javascript:void(0);" class="<?php echo $tabItems[$i]->cssClass ?>"><?php echo $tabItems[$i]->title ?></a></li>
		<?php endif; ?>
	    <?php endfor; ?>
        </ul>                                
    </div>
    <div class="tcon">
	<?php foreach ($tabItems as $tabItem) : ?>

	    <?php if ($tabItem->status == LGConstant::PUBLISH_STATUS): ?>
		<div class="titem">
		    <?php
		    echo $tabItem->description;
		    if (isset($tabItem->link) && !empty($tabItem->link)):
			?>
	    	    <p>
	    		<a class="mb-more" style='float: right;' href="<?php echo $tabItem->link ?>">Read more >></a>
	    	    </p>
		    <?php endif; ?>
		</div>
	    <?php endif;
	    ?>


	<?php endforeach; ?>
    </div>
</div>